package problem119;

//119.杨辉三角形2
//https://leetcode.cn/problems/pascals-triangle-ii/

import java.util.ArrayList;
import java.util.List;

class Solution {
    public List<Integer> getRow(int rowIndex) {
        int n = rowIndex + 1;
        int[][] arr = new int[n+1][n+1];
        arr[1][1] = 1;
        for(int i = 2; i<=n; i++) {
            for(int j = 1; j<=n; j++) {
                arr[i][j] = arr[i-1][j-1] + arr[i-1][j];
            }
        }
        List<Integer> list = new ArrayList<>();
        for(int j = 1; j<=n; j++) {
            list.add(arr[n][j]);
        }
        return list;
    }
}